package com.lightboat.common.enums;

import lombok.Getter;

/**
 * 快递公司枚举
 */
@Getter
public enum ExpressCompanyEnum {

    YUANTONG("yuantong", "圆通"),
    SHUNFENG("shunfeng", "顺丰"),
    EMS("ems", "ems"),
    ZHONGTONG("zhongtong", "中通"),
    SHENTONG("shentong", "申通"),
    YUNDA("yunda", "韵达"),
    RUFENGDA("rufengda", "如达"),
    ZHAIJISONG("zhaijisong", "宅急送"),
    TIANTIAN("tiantian", "天天"),
    HUITONGKUAIDI("huitongkuaidi", "百世快递"),
    JD("jd", "京东"),
    JINGDONGKUAIYUN("jingdongkuaiyun", "京东快运"),
    DEBANGWULIU("debangwuliu", "德邦快递"),
    JTEXPRESS("jtexpress", "极兔速递"),
    FENGWANG("fengwang", "丰网速运"),
    JINGGUANGSUDIKUAIJIAN("jinguangsudikuaijian", "京广速递"),
    KUAIJIESUDI("kuaijiesudi", "快捷速递"),
    CESS("cess", "国通快递"),
    QUANFENGKUAIDI("quanfengkuaidi", "全峰快递"),
    YOUSHUWULIU("youshuwuliu", "优速快递"),
    EMS_ECONOMIC("ems", "EMS经济快递"),
    DANNIAO("danniao", "菜鸟速递"),
    ANNENGWULIU("annengwuliu", "安能快运"),
    KUAYUE("kuayue", "跨越速运"),
    XINFENGWULIU("xinfengwuliu", "信丰物流"),
    POSTAL_EXPRESS("ems", "邮政快递包裹");

    private final String code;
    private final String name;

    ExpressCompanyEnum(String code, String name) {
        this.code = code;
        this.name = name;
    }

    public static ExpressCompanyEnum getByCode(String code) {
        for (ExpressCompanyEnum express : values()) {
            if (express.getCode().equals(code)) {
                return express;
            }
        }
        return null;
    }

    public static ExpressCompanyEnum getByName(String name) {
        for (ExpressCompanyEnum express : values()) {
            if (express.getName().equals(name)) {
                return express;
            }
        }
        return null;
    }
}